package com.wangshouyu.mp.pay.v3.transactions;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;
import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author 王守钰
 * @date 2020年08月12日 22:22
 * @description: 微信jsapi响应
 */
public class TransactionsJsApiResponse implements Serializable {

    /**
     * 公众号id
     */
    private String appId;

    /**
     * 时间戳
     */
    private String timeStamp;

    /**
     * 随机字符串
     */
    private String nonceStr;

    /**
     * 订单详情扩展字符串
     */
    @JsonProperty(value = "package")
    @SerializedName(value = "package")
    @JSONField(name = "package")
    @XStreamAlias(value = "package")
    private String packageStr;

    /**
     * 签名方式
     */
    private String signType;

    /**
     * 签名
     */
    private String paySign;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(String timeStamp) {
        this.timeStamp = timeStamp;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getPackageStr() {
        return packageStr;
    }

    public void setPackageStr(String packageStr) {
        this.packageStr = packageStr;
    }

    public String getSignType() {
        return signType;
    }

    public void setSignType(String signType) {
        this.signType = signType;
    }

    public String getPaySign() {
        return paySign;
    }

    public void setPaySign(String paySign) {
        this.paySign = paySign;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        TransactionsJsApiResponse that = (TransactionsJsApiResponse) o;
        return Objects.equals(appId, that.appId) &&
                Objects.equals(timeStamp, that.timeStamp) &&
                Objects.equals(nonceStr, that.nonceStr) &&
                Objects.equals(packageStr, that.packageStr) &&
                Objects.equals(signType, that.signType) &&
                Objects.equals(paySign, that.paySign);
    }

    @Override
    public int hashCode() {
        return Objects.hash(appId, timeStamp, nonceStr, packageStr, signType, paySign);
    }

    @Override
    public String toString() {
        return "TransactionsJsApiResponse{" +
                "appId='" + appId + '\'' +
                ", timeStamp='" + timeStamp + '\'' +
                ", nonceStr='" + nonceStr + '\'' +
                ", packageStr='" + packageStr + '\'' +
                ", signType='" + signType + '\'' +
                ", paySign='" + paySign + '\'' +
                '}';
    }

    public TransactionsJsApiResponse(String appId, String timeStamp, String nonceStr, String packageStr, String signType, String paySign) {
        this.appId = appId;
        this.timeStamp = timeStamp;
        this.nonceStr = nonceStr;
        this.packageStr = packageStr;
        this.signType = signType;
        this.paySign = paySign;
    }

    public TransactionsJsApiResponse() {
    }
}
